﻿package PinballCode {
	
	import flash.display.Sprite;
	
	// Hud displayed in the game
	public class HUD extends Sprite {

		var score:uint;			// score varible
		var balls:int;			// balls varible
		
		//Propertys
		public function get Balls():int { return balls; }
		
		
		// constructor
		public function HUD() {
			// constructor code
			init();
		}
		
		//initializes game
		public function init()
		{
			score = 0;
			balls = 3;
			updateHUD();
		}
		
		// updates the Hud display
		public function updateHUD()
		{
			score_txt.text = ""+ score;
			balls_txt.text = ""+ balls;
		}
		
		// loses a ball
		public function loseBall()
		{
			balls -= 1;
			updateHUD();
		}
		
		// Score changes
		public function changeScore(n:Number)
		{
			score+=n;
		}

	}
	
}
